home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks97 / WarriorsProgress.sit / Warrior’s Progress / source code / Source / Libraries / Activation / ActivationLink.h < prev    next >
Text File  |  1997-06-28  |  789b  |  45 lines

  1. // ActivationLink.h
  2.  
  3. #ifndef ActivationLink_h
  4. #define ActivationLink_h
  5.  
  6. #ifndef Activator_h
  7. #include "Activator.h"
  8. #endif
  9.  
  10. template < class Target >
  11. class ActivationLink: public Activator
  12.   {
  13.     typedef Target TargetType;
  14.     
  15.     private:
  16.         Target& target;
  17.         void (TargetType::*activate)();
  18.         void (TargetType::*deactivate)();
  19.     
  20.     public:
  21.         ActivationLink( Focus& focus,
  22.                              Target& theTarget,
  23.                              void (TargetType::*activator)(),
  24.                              void (TargetType::*deactivator)() )
  25.           : Activator( focus ),
  26.              target( theTarget ),
  27.              activate( activator ),
  28.              deactivate( deactivator )
  29.           {}
  30.         
  31.         virtual void Activate()
  32.           {
  33.             if ( activate != 0 )
  34.                 (this->*activate)();
  35.           }
  36.         
  37.         virtual void Deactivate()
  38.           {
  39.             if ( deactivate != 0 )
  40.                 (this->*deactivate)();
  41.           }
  42.   };
  43.  
  44. #endif
  45.